<?php

namespace App\Http\Controllers\api;

use App\FeedBack;
use App\Http\Services\UserManager;
use App\ProjectInfo;
use App\Userinfo;
use http\Env\Response;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use phpDocumentor\Reflection\Project;
use phpDocumentor\Reflection\Types\Context;

class ProjectInfoController extends Controller
{
        public  function  getProjectInfo(Request $request){
            $content=ProjectInfo::orderBy('created_at','desc')->get();
        return Response()->json(['level'=>'success','message'=>'获取成功','data'=>$content]);

    }
       public  function  setFeedBack(Request $request){
            $desc         =$request->get('desc');
            $phone        =$request->get('phone');


            $user=UserManager::isLogin($request);
            if (!$user)
               return response()->json(['level'=>'error','message'=>'请先登录','data'=>'no_login']);

           $feedBack= new FeedBack();
           if(!is_null($desc))$feedBack->desc=$desc;
           if(!is_null($phone))$feedBack->phone=$phone;
           $feedBack->save();

           return response()->json(['level' => 'success','message' => '添加成功','data' => $feedBack]);

       }
}
